#include "PrecompiledHeader_Engineer.h"
#include "Fireplace.h"

/*--------------------------------------------------------------------------*/

Fireplace::Fireplace(Quad* parent, const glm::vec3& position) :
	IQuadObject(parent, position)
{
	this->m_fireplaceRenderable.SetParent(parent);
	this->m_fireplaceRenderable.SetPosition(position);

	this->m_fireplaceRenderable.SetHighQualityVao(OpenGL::GetSmallSphereVao());
	this->m_fireplaceRenderable.SetLowQualityVao(OpenGL::GetSmallSphereVao());
	this->m_fireplaceRenderable.SetOcclusionTestEnabled(false);
	this->m_fireplaceRenderable.SetScale(1.0f);
	this->m_fireplaceRenderable.SetRadius(15.0f);

	this->m_lightSource.SetParent(&this->m_fireplaceRenderable);
	this->m_lightSource.SetPosition(glm::vec3());
	this->m_lightSource.SetAmbient(vl::Black);
	this->m_lightSource.SetDiffuse(vl::White);

	//this->m_smokeEmitter.SetParent(&this->m_fireplaceRenderable);
	//this->m_smokeEmitter.SetDirection(glm::vec3(0.0f, 1.0f, 0.0f));
	//this->m_smokeEmitter.SetRadius(15.0f);
}

/*--------------------------------------------------------------------------*/

Fireplace::~Fireplace()
{
}

/*--------------------------------------------------------------------------*/

void Fireplace::Update()
{
	float f = 0.5f + (rand() % 100) / 200.0f;
	this->m_lightSource.SetAmbient(Color(f, f, 0.0f, 1.0));
	this->m_lightSource.SetDiffuse(this->m_lightSource.GetAmbient());
	this->m_lightSource.SetRadius(10.0f + (rand() % 500) / 200.0f);
}

/*--------------------------------------------------------------------------*/
